package cn.supermarket.mapper;

import cn.supermarket.pojo.dto.RefundSimple;
import cn.supermarket.pojo.entity.Refund;
import cn.supermarket.pojo.vo.RefundDetailsVO;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 退款表---石彦春 Mapper 接口
 * </p>
 *
 * @author the shy
 * @since 2022-06-18
 */
@Repository
public interface RefundMapper{

    /**
     * 添加新的退款单
     * @param refund
     * @return
     */
    Long insert(Refund refund);

    /**
     * 查订单简易信息
     * @param id
     * @return
     */
    RefundSimple selectById(Long id);

    /**
     * 修改启用/可见/作废//备注
     * @param id
     * @param  isEnable,isDisplay,isCancel,other
     * @return
     */
    int updateIsEnable(Long id, Integer isEnable);

    int updateIsDisplay(Long id, Integer isDisplay);

    int updateIsCancel(Long id);

    int updateOther(Long id, String other);

    /**
     * 按照退款单号查询
     */
    RefundDetailsVO selectByNumber(String number);

    /**
     * 根据订单编号查询
     */
    RefundDetailsVO selectByOrderNumber(String orderNumber);
    /**
     * 按照日期查询
     */
    List<RefundDetailsVO> selectListByDatetime(LocalDateTime start, LocalDateTime end);

    /**
     * 按照供货商查询
     */
    List<RefundDetailsVO> selectBySupplier(String supplier);

    /**
     * 按照收款人查询
     */
    List<RefundDetailsVO> selectByCollect(String collect);

    /**
     * 更新最后修改日期
     */
    int updateLastUpdateTime(LocalDateTime time, Long id);
}
